﻿
using Unity.Burst;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;

namespace DotsGame
{
    [BurstCompile]
    partial struct jobs_effect : IJobEntity
    {
        public ThreadRandom trandom;
        public EntityCommandBuffer.ParallelWriter commandBuffer;
        public float delta;
        public void Execute([ChunkIndexInQuery] int chunk_index, [EntityIndexInQuery] int entity_index, Entity entity, ref comp_autodestory_effect effect)
        {
            effect.lifetime -= delta;
            if (effect.lifetime <= 0)
            {
                commandBuffer.DestroyEntity(chunk_index, entity);

            }
        }
    }
}
